<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Testing</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
<link rel="home" href="index.html" title="GDK参考手册">
<link rel="up" href="reference.html" title="API参考">
<link rel="prev" href="gdk-Application-launching.html" title="Application launching">
<link rel="next" href="api-index-full.html" title="所有符号索引">
<meta name="generator" content="GTK-Doc V1.17 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
<tr valign="middle">
<td><a accesskey="p" href="gdk-Application-launching.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
<td><a accesskey="u" href="reference.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
<th width="100%" align="center">GDK参考手册</th>
<td><a accesskey="n" href="api-index-full.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
</tr>
<tr><td colspan="5" class="shortcuts">
<a href="#gdk-Testing.synopsis" class="shortcut">Top</a>
                   | 
                  <a href="#gdk-Testing.description" class="shortcut">Description</a>
</td></tr>
</table>
<div class="refentry">
<a name="gdk-Testing"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle"><a name="gdk-Testing.top_of_page"></a>Testing</span></h2>
<p>Testing — Test utilities</p>
</td>
<td valign="top" align="right"></td>
</tr></table></div>
<div class="refsynopsisdiv">
<a name="gdk-Testing.synopsis"></a><h2>Synopsis</h2>
<pre class="synopsis">
#include &lt;gdk/gdk.h&gt;

<span class="returnvalue">void</span>                <a class="link" href="gdk-Testing.html#gdk-test-render-sync" title="gdk_test_render_sync ()">gdk_test_render_sync</a>                (<em class="parameter"><code><a class="link" href="gdk-Windows.html#GdkWindow"><span class="type">GdkWindow</span></a> *window</code></em>);
<a href="../glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            <a class="link" href="gdk-Testing.html#gdk-test-simulate-button" title="gdk_test_simulate_button ()">gdk_test_simulate_button</a>            (<em class="parameter"><code><a class="link" href="gdk-Windows.html#GdkWindow"><span class="type">GdkWindow</span></a> *window</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a> x</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a> y</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#guint"><span class="type">guint</span></a> button</code></em>,
                                                         <em class="parameter"><code><a class="link" href="gdk-Windows.html#GdkModifierType" title="enum GdkModifierType"><span class="type">GdkModifierType</span></a> modifiers</code></em>,
                                                         <em class="parameter"><code><a class="link" href="gdk-Events.html#GdkEventType" title="enum GdkEventType"><span class="type">GdkEventType</span></a> button_pressrelease</code></em>);
<a href="../glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            <a class="link" href="gdk-Testing.html#gdk-test-simulate-key" title="gdk_test_simulate_key ()">gdk_test_simulate_key</a>               (<em class="parameter"><code><a class="link" href="gdk-Windows.html#GdkWindow"><span class="type">GdkWindow</span></a> *window</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a> x</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a> y</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#guint"><span class="type">guint</span></a> keyval</code></em>,
                                                         <em class="parameter"><code><a class="link" href="gdk-Windows.html#GdkModifierType" title="enum GdkModifierType"><span class="type">GdkModifierType</span></a> modifiers</code></em>,
                                                         <em class="parameter"><code><a class="link" href="gdk-Events.html#GdkEventType" title="enum GdkEventType"><span class="type">GdkEventType</span></a> key_pressrelease</code></em>);
</pre>
</div>
<div class="refsect1">
<a name="gdk-Testing.description"></a><h2>Description</h2>
<p>
The functions in this section are intended to be used in test programs.
They allow to simulate some user input.
</p>
</div>
<div class="refsect1">
<a name="gdk-Testing.details"></a><h2>Details</h2>
<div class="refsect2">
<a name="gdk-test-render-sync"></a><h3>gdk_test_render_sync ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                gdk_test_render_sync                (<em class="parameter"><code><a class="link" href="gdk-Windows.html#GdkWindow"><span class="type">GdkWindow</span></a> *window</code></em>);</pre>
<p>
This function retrives a pixel from <em class="parameter"><code>window</code></em> to force the windowing
system to carry out any pending rendering commands.
This function is intended to be used to syncronize with rendering
pipelines, to benchmark windowing system rendering operations.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><p><span class="term"><em class="parameter"><code>window</code></em> :</span></p></td>
<td>a mapped GdkWindow</td>
</tr></tbody>
</table></div>
<p class="since">Since 2.14</p>
</div>
<hr>
<div class="refsect2">
<a name="gdk-test-simulate-button"></a><h3>gdk_test_simulate_button ()</h3>
<pre class="programlisting"><a href="../glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            gdk_test_simulate_button            (<em class="parameter"><code><a class="link" href="gdk-Windows.html#GdkWindow"><span class="type">GdkWindow</span></a> *window</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a> x</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a> y</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#guint"><span class="type">guint</span></a> button</code></em>,
                                                         <em class="parameter"><code><a class="link" href="gdk-Windows.html#GdkModifierType" title="enum GdkModifierType"><span class="type">GdkModifierType</span></a> modifiers</code></em>,
                                                         <em class="parameter"><code><a class="link" href="gdk-Events.html#GdkEventType" title="enum GdkEventType"><span class="type">GdkEventType</span></a> button_pressrelease</code></em>);</pre>
<p>
This function is intended to be used in Gtk+ test programs.
It will warp the mouse pointer to the given (<em class="parameter"><code>x</code></em>,<em class="parameter"><code>y</code></em>) corrdinates
within <em class="parameter"><code>window</code></em> and simulate a button press or release event.
Because the mouse pointer needs to be warped to the target
location, use of this function outside of test programs that
run in their own virtual windowing system (e.g. Xvfb) is not
recommended.
Also, <code class="function">gtk_test_simulate_button()</code> is a fairly low level function,
for most testing purposes, <code class="function">gtk_test_widget_click()</code> is the right
function to call which will generate a button press event followed
by its accompanying button release event.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>window</code></em> :</span></p></td>
<td>Gdk window to simulate a button event for.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>x</code></em> :</span></p></td>
<td>x coordinate within <em class="parameter"><code>window</code></em> for the button event.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>y</code></em> :</span></p></td>
<td>y coordinate within <em class="parameter"><code>window</code></em> for the button event.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>button</code></em> :</span></p></td>
<td>Number of the pointer button for the event, usually 1, 2 or 3.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>modifiers</code></em> :</span></p></td>
<td>Keyboard modifiers the event is setup with.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>button_pressrelease</code></em> :</span></p></td>
<td>either <a class="link" href="gdk-Events.html#GDK-BUTTON-PRESS:CAPS"><code class="literal">GDK_BUTTON_PRESS</code></a> or <a class="link" href="gdk-Events.html#GDK-BUTTON-RELEASE:CAPS"><code class="literal">GDK_BUTTON_RELEASE</code></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>wether all actions neccessary for a button event simulation were carried out successfully.</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.14</p>
</div>
<hr>
<div class="refsect2">
<a name="gdk-test-simulate-key"></a><h3>gdk_test_simulate_key ()</h3>
<pre class="programlisting"><a href="../glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            gdk_test_simulate_key               (<em class="parameter"><code><a class="link" href="gdk-Windows.html#GdkWindow"><span class="type">GdkWindow</span></a> *window</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a> x</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a> y</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#guint"><span class="type">guint</span></a> keyval</code></em>,
                                                         <em class="parameter"><code><a class="link" href="gdk-Windows.html#GdkModifierType" title="enum GdkModifierType"><span class="type">GdkModifierType</span></a> modifiers</code></em>,
                                                         <em class="parameter"><code><a class="link" href="gdk-Events.html#GdkEventType" title="enum GdkEventType"><span class="type">GdkEventType</span></a> key_pressrelease</code></em>);</pre>
<p>
This function is intended to be used in Gtk+ test programs.
If (<em class="parameter"><code>x</code></em>,<em class="parameter"><code>y</code></em>) are &gt; (-1,-1), it will warp the mouse pointer to
the given (<em class="parameter"><code>x</code></em>,<em class="parameter"><code>y</code></em>) corrdinates within <em class="parameter"><code>window</code></em> and simulate a
key press or release event.
When the mouse pointer is warped to the target location, use
of this function outside of test programs that run in their
own virtual windowing system (e.g. Xvfb) is not recommended.
If (<em class="parameter"><code>x</code></em>,<em class="parameter"><code>y</code></em>) are passed as (-1,-1), the mouse pointer will not
be warped and <em class="parameter"><code>window</code></em> origin will be used as mouse pointer
location for the event.
Also, <code class="function">gtk_test_simulate_key()</code> is a fairly low level function,
for most testing purposes, <code class="function">gtk_test_widget_send_key()</code> is the
right function to call which will generate a key press event
followed by its accompanying key release event.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>window</code></em> :</span></p></td>
<td>Gdk window to simulate a key event for.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>x</code></em> :</span></p></td>
<td>x coordinate within <em class="parameter"><code>window</code></em> for the key event.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>y</code></em> :</span></p></td>
<td>y coordinate within <em class="parameter"><code>window</code></em> for the key event.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>keyval</code></em> :</span></p></td>
<td>A Gdk keyboard value.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>modifiers</code></em> :</span></p></td>
<td>Keyboard modifiers the event is setup with.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>key_pressrelease</code></em> :</span></p></td>
<td>either <a class="link" href="gdk-Events.html#GDK-KEY-PRESS:CAPS"><code class="literal">GDK_KEY_PRESS</code></a> or <a class="link" href="gdk-Events.html#GDK-KEY-RELEASE:CAPS"><code class="literal">GDK_KEY_RELEASE</code></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>wether all actions neccessary for a key event simulation were carried out successfully.</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.14</p>
</div>
</div>
</div>
<div class="footer">
<hr>
          Generated by GTK-Doc V1.17</div>
</body>
</html>